package com.dmai.aiet.epc.archive.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dmai.aiet.epc.archive.base.PageResult;
import com.dmai.aiet.epc.archive.entity.SpecialTopicContainingCourses;
import com.dmai.aiet.epc.archive.mapper.SpecialTopicContainingCoursesDao;
import com.dmai.aiet.epc.archive.service.SpecialTopicContainingCoursesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.MapUtils;



@Service
public class SpecialTopicContainingCoursesServiceImpl  implements SpecialTopicContainingCoursesService {

    @Autowired
    private SpecialTopicContainingCoursesDao specialTopicContainingCoursesDao;



    /**
     * 查询记录
     * @param id
     * @return
     */
    public SpecialTopicContainingCourses findById(String id){
        return specialTopicContainingCoursesDao.findById(id);
    }

    /**
     * 分页
     * @param params
     * @return
     */
    public PageResult<SpecialTopicContainingCourses> pageAll(Map<String, Object> params){


        Page<SpecialTopicContainingCourses> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
        List<SpecialTopicContainingCourses> list = specialTopicContainingCoursesDao.pageAll(page, params);
        long total = page.getTotal();
        if (total > 0) {

        }
        return PageResult.<SpecialTopicContainingCourses>builder().data(list).code(0).count(total).build();

    }

    /**
    * 列表
    * @param params
    * @return
    */
    public List<SpecialTopicContainingCourses> findAll(Map<String, Object> params){
        return  specialTopicContainingCoursesDao.findAll(params);
    }

}
